package dhadi.use.swing;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class BoardUiMouseListener implements MouseListener {
	
	private BoardUi boardUi;
	public BoardUiMouseListener(BoardUi boardUi)
	{
		this.boardUi = boardUi;				
	}

	public void mousePressed(MouseEvent e) {
		if (this.boardUi.getMovingPick() != null)
		{
			PickUi movingPick = this.boardUi.getMovingPick();
			movingPick.onMousePressed(e);
			this.boardUi.paintImmediately(this.boardUi.getBounds());
		}
	}

	public void mouseReleased(MouseEvent e) {
		
		if (this.boardUi.getMovingPick() != null)
		{
			this.boardUi.getMovingPick().onMouseReleased(e);
			this.boardUi.setMovingPick(null);
			this.boardUi.repaint();
		}
	}

	public void mouseClicked(MouseEvent e) {

	}

	public void mouseEntered(MouseEvent e) {

	}

	public void mouseExited(MouseEvent e) {

	}
}
